# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-pecl-apcu
_extname=apcu
pkgver=5.1.21
pkgrel=0
pkgdesc="PHP 8 extension APC User Cache - PECL"
url="https://pecl.php.net/package/apcu"
arch="all"
license="PHP-3.01"
depends="php8-common"
makedepends="php8-dev"
checkdepends="php8-pcntl"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"
provides="php8-apcu=$pkgver-r$pkgrel" # for backward compatibility
replaces="php8-apcu" # for backward compatibility

build() {
	phpize8
	./configure --prefix=/usr --with-php-config=php-config8
	make
}

check() {
	local _modules=/usr/lib/php8/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/pcntl.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir"/ install
	install -D -m644 apc.php "$pkgdir"/usr/share/php8/apcu/apc.php

	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
a6ffe8349760d27cde0d86017a59a68e9639bf385e606622d807094f4e5fb305bb25b9ce00077d0856f4d223d44329f7a6314c229b62c78d8e2b085593c92bb3  php-pecl-apcu-5.1.21.tgz
"
